﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using YArchitech.Controls;
using YArchitech.LIB;
using HYRevitCode.FormUtility;
using QuickModel.DuctFastModel;

namespace QuickModel.Forms
{
	public partial class DuctSetForm : System.Windows.Forms.Form
	{
		public DuctSetForm()
		{
			this.InitializeComponent();
		}

		private void btnSetIsOK_Click(object sender, EventArgs e)
		{
			bool flag = !string.IsNullOrEmpty(this.txtBoxDuctFromText.Text);
			if (flag)
			{
				bool flag2 = JudgeGroup.IsNumber(this.txtBoxDuctFromText.Text.Trim());
				if (flag2)
				{
					this.m_strHeight = Convert.ToDouble(this.txtBoxDuctFromText.Text);
					base.Close();
				}
				else
				{
					YJKMessageBox.Show("风管标注距风管最大距离为数字！");
				}
			}
			else
			{
				YJKMessageBox.Show("请填写风管标注距风管最大距离！");
			}
		}

		private void btnSetIsCancel_Click(object sender, EventArgs e)
		{
			bool flag = this.m_strHeight > 0.0;
			if (flag)
			{
				this.txtBoxDuctFromText.Text = this.m_strHeight.ToString();
			}
			base.Close();
		}

		private void DuctSetForm_Load(object sender, EventArgs e)
		{
			base.Icon = Resource.YArchitechIcon;
			this.txtBoxDuctFromText.Text = "800";
			this.AddControlGroup();
			this.m_ControlInfoManager = new ControlInfoManager(this, this.m_lstControlGroup, null, null);
			this.m_ControlInfoManager.SetControlInfoToForm();
			this.m_strHeight = Convert.ToDouble(this.txtBoxDuctFromText.Text);
		}

		private void DuctSetForm_FormClosed(object sender, FormClosedEventArgs e)
		{
			bool flag = this.m_ControlInfoManager != null;
			if (flag)
			{
				this.m_ControlInfoManager.GetControlInfoToXml();
			}
		}

		private void AddControlGroup()
		{
			this.m_lstControlGroup.Add(new KeyValuePair<System.Windows.Forms.Control, bool>(this, false));
			this.m_lstControlGroup.Add(new KeyValuePair<System.Windows.Forms.Control, bool>(this.txtBoxDuctFromText, false));
		}

		private void DuctSetForm_KeyDown(object sender, KeyEventArgs e)
		{
			bool flag = e.KeyValue == 27;
			if (flag)
			{
				base.Close();
			}
		}

		private ControlInfoManager m_ControlInfoManager = null;

		private List<KeyValuePair<System.Windows.Forms.Control, bool>> m_lstControlGroup = new List<KeyValuePair<System.Windows.Forms.Control, bool>>();

		public double m_strHeight = 0.0;
	}
}
